package com.example.mideaoem.api;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.example.mideaoem.api.handler.ResponseHandler;

public class BaseAPI {

	public static String appId = "1005";
	public static String src = "5";
	public static String appKey = "434a209a5ce141c3b726de067835d7f0";
	
	public static String server_url = "http://mapp.appsmb.com:10050/v1"; //正式版
//	public static String server_url = "http://52.34.46.78:10050/v1"; //测试版
//	public static String server_url = "http://app-awsproduc-673663248.us-west-2.elb.amazonaws.com:10050/v1";//测试版2
	public final static int POST_FAILED = -1;
	public final static int USER_LOGIN = 1;
	public final static int USER_REGISTER = 3;
	public final static int CHECK_EMAIL = 4;
	public final static int USER_ID= 5;
	public final static int USER_EMAIL_LOGIN = 6;
	public final static int USER_LOGOUT = 7;
	public final static int USER_INFO = 8;
	public final static int USER_UPDATE_PASSWORD = 9;
	public final static int USER_RESET_PASSWORD = 10;
	public final static int HOME_LIST = 11;
	public final static int HOME_ADD = 12;
	public final static int HOME_DELETE = 13;
	public final static int DEVICE_LIST = 14;
	public final static int DEVICE_ACTIVE = 15;
	public final static int DEVICE_DELETE = 16;
	public final static int DEVICE_CMD = 17;
	public final static int REFRESH_TOKEN = 18;
	
	public static final int DEVICE_INFO = 19;
	public static final int UPDATE_CHECK = 20;
	public static final int UPDATE_GET = 21;
	public static final int SESSION_REFRESH = 22;

	//电量
	public static final int ELEC_QUERY = 23;
	
	//舒睡
	public static final int CURVE_QUERY = 24;
	public static final int CURVE_UPADTE = 25;
	public static final int CURVE_START = 26;
	public static final int CURVE_STOP = 27;
	public static final int CURVE_ADD = 28;
	public static final int CURVE_DEL = 29;
	
	//体检
	public static final int CHECK_START = 30;
	public static final int CHECK_DETAIL = 31;
	
	//预约
	public static final int APPOINT_ADD = 32;
	public static final int APPOINT_UPDATE = 33;
	public static final int APPOINT_QUERY = 34;
	public static final int APPOINT_START = 35;
	public static final int APPOINT_STOP = 36;
	
	//T1推送
	public static final int T1_QUERY = 37; 
	public static final int T1_ADD = 38;
	public static final int T1_UPDATE = 39;
	
	public static final int APP2BASE = 40;
	
	public static final int APP_CHECKFORUPDATE = 41;
	public static final int APP_UPDATE = 42;
	public static final int USER_PIC = 43;
	
	
	public static final int MEMBER_ACK = 44;
	public static final int MEMBER_REQ = 45;
	
	public static final int USER_MODIFY = 46;
	public static final int DEVICE_MODIFY = 47;
	
	public static final int SENDACTIVEMAIL = 48;
	
	public final static int TOAST_MSG = 9999;
	
	protected static Map<Integer, String> map = new HashMap<Integer, String>();
	
	static {
		
		map.put(MEMBER_REQ, "homegroup/member/add/send");
		map.put(MEMBER_ACK, "homegroup/member/add/response");
		
		map.put(APP_CHECKFORUPDATE, "app/update/check");
		map.put(APP_UPDATE, "app/info/get");
		
		
		map.put(CHECK_EMAIL, "user/email/used");
		map.put(USER_REGISTER, "user/email/register");
		map.put(USER_ID, "user/login/id/get");
		map.put(USER_EMAIL_LOGIN, "user/login");
		map.put(USER_LOGOUT, "user/logout");
		map.put(USER_INFO, "user/info/get");
		map.put(USER_UPDATE_PASSWORD, "user/password/modify");
		map.put(USER_RESET_PASSWORD, "user/password/email/reset");
		map.put(USER_PIC, "user/profile/pic/upload");
		
		map.put(USER_MODIFY, "user/info/modify");
		map.put(DEVICE_MODIFY, "appliance/info/modify");
		
		map.put(HOME_LIST, "homegroup/list/get");
		map.put(HOME_ADD, "homegroup/add");
		map.put(HOME_DELETE, "homegroup/delete");
		map.put(DEVICE_LIST, "appliance/list/get");
		map.put(DEVICE_ACTIVE, "appliance/active");
		map.put(DEVICE_DELETE, "appliance/delete");
		map.put(DEVICE_CMD, "appliance/transparent/send");
		map.put(USER_LOGIN, "http://121.42.15.85:8000/api/user/login");
		
		map.put(SESSION_REFRESH, "user/session/update");
		map.put(REFRESH_TOKEN, "user/push/token/update");
		
		map.put(CURVE_QUERY, "/sleepcurve/getSleepCurveStatus");
		map.put(CURVE_START, "/sleepcurve/startSleepCurve");
		map.put(CURVE_STOP, "/sleepcurve/closeSleepCurve");
		map.put(CURVE_UPADTE, "/sleepcurve/updateSleepCurve");
		map.put(CURVE_ADD, "");
		map.put(CURVE_DEL, "");
		
		map.put(ELEC_QUERY, "/electricity/queryElec");
		
		map.put(CHECK_START, "/acCheck/startACCheck");
		map.put(CHECK_DETAIL, "/acCheck/acCheckDetails");
		
		map.put(APPOINT_ADD, "/applianceappoint/addApplianceAppoint");
		map.put(APPOINT_QUERY, "/applianceappoint/getApplianceAppointList");
		map.put(APPOINT_START, "/applianceappoint/startApplianceAppoint");
		map.put(APPOINT_UPDATE, "/applianceappoint/updateApplianceAppoint");
		map.put(APPOINT_STOP, "/applianceappoint/closeApplianceAppoint");
		
		
		map.put(T1_QUERY, "/t1/gett1Schedule");
		map.put(T1_ADD, "/t1/pusht1Schedule");
		map.put(T1_UPDATE, "/t1/updatet1Schedule");
		
		map.put(APP2BASE, "app2base/data/transmit");
		
		map.put(SENDACTIVEMAIL, "user/get/email/active");
	};
	
	public BaseAPI(){
	}
	
	
	public static class NetResponseBase implements ResponseHandler{
		public int errCode;
		public String errMsg;
		@Override
		public void DataReceive(String json) {
			// TODO Auto-generated method stub
			
		}
	}
	
	public static class NetResponse<T> extends NetResponseBase{
		public T success;
		public T getT(){
			return success;
		}
		
		public void setT(T success){
			this.success = success;
		}
		
		@Override
		public String toString() {
			return success+"  "+errCode+"  "+errMsg;
		}
	}
	
	public static class NetResponseList<T> extends NetResponseBase{
		List<T> success;
		
		public List<T> getT(){
			return success;
		}
		
		public void setT(List<T> t){
			success = t;
		}
		
	}
	
}
